# Contributor: Carlo Landmeter
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iscsi-scst
pkgver=2.2.1
pkgrel=6
pkgdesc="ISCSI target for SCST - userspace tools"
url="https://scst.sourceforge.net/"
arch="all"
license="GPL-2.0-only"
makedepends="linux-headers bash"
subpackages="$pkgname-openrc"
source="https://downloads.sourceforge.net/scst/iscsi-scst-$pkgver.tar.bz2
	https://downloads.sourceforge.net/scst/scst-$pkgver.tar.bz2
	$pkgname.initd
	$pkgname.confd
	scst.conf
	"
options="!check"

prepare() {
	cp Makefile_user_space_only Makefile
}

build() {
	make all SCST_INC_DIR="$srcdir/scst-$pkgver/include"
}

package() {
	# make install is broken
	install -D usr/iscsi-scstd "$pkgdir"/usr/sbin/iscsi-scstd
	install -D usr/iscsi-scst-adm "$pkgdir"/usr/sbin/iscsi-scst-adm
	install -D -m 755 "$srcdir"/iscsi-scst.initd "$pkgdir"/etc/init.d/iscsi-scst
	install -D -m 644 "$srcdir"/iscsi-scst.confd "$pkgdir"/etc/conf.d/iscsi-scst
	install -D -m 644 "$srcdir"/scst.conf "$pkgdir"/etc/scst.conf
}

sha512sums="3be7013a75c8f8145e70498b5e8aa6ade419d947e54350e856f4af7a6338741cec9b0f79e4e747b7187274b0c4de2d5c7d28f24a0a7d1549ab712da1068d6b39  iscsi-scst-2.2.1.tar.bz2
6e1b3e1ab92de2d46715a2db546419ff2d122c386756fda8000413f9b0416088947acc9441a6e18b74fe32f491c03a6fea325b70a9ae6a6888039dcffe093c3d  scst-2.2.1.tar.bz2
b96b32d8fe15c2b824bb4d28300420c169556b5babc75bad4bc48c3c1cd453397c24f3058b54ec2a52fbd6f925124a88440b8c8839cc1147239a29a0e76081a4  iscsi-scst.initd
2cb3907fbe9e0685bb7fc7f7108a6834f04a0a1e46f9e2d440cfcc627678f02a8c91fc61cc0ac06b4b014f76bc46ab42c611ba3b76db4ae37688011a9684cce6  iscsi-scst.confd
bde98028689e075c07ae8b94ac94a76ca53142cd57f7dca6c209f46489ea66da4e50e56eab5405821008a5b4a72174faa3f45f39ec8844dfe0f18f8cd891195f  scst.conf"
